const { Router } = require("express")
const register = require("./controller/register.controller.js")
const user = require("./controller/user.controller.js")
const order = require("./controller/order.controller.js")
const multer = require('multer')
const app = Router()
const uploadcontroller = require("./controller/upload.controller.js")
const upload = multer({ dest: 'static/uploads/' })
app.post("/register/add", register.add)
app.post("/login", register.login)

// 用户列表
app.post("/getuserlist", user.getlist)

// 订单模块
app.post("/order/add", order.add)
app.post("/order/list", order.getorder)
app.post("/order/accept", order.jiedan)

app.post("/order/myself", order.myself)
app.post("/order/totallist", order.list)
app.post("/order/status", order.Orderstatic)
app.post("/order/translate", order.Orderstatic2)


//  接受文件

app.post("/systemfile", upload.single('file'), uploadcontroller.addfile)
app.post("/systemfile2", upload.single('file'), uploadcontroller.addfile2)
app.post("/order/getfile", order.orderfile)
app.post("/order/myselfdeteltfile", uploadcontroller.deletefile)
app.post("/order/orderpay", order.orderpay)

//  修改密码
app.post("/user/edit", user.edit)
app.post("/user/info", user.userinfo)

//  当前所有注册路由

app.post("/index/order", user.orderdata)

module.exports = app